package com.dinzeer.godfox.data;

import com.dinzeer.godfox.regsiter.GBItemRegsitry;
import mods.flammpfeil.slashblade.data.builtin.SlashBladeBuiltInRegistry;
import mods.flammpfeil.slashblade.init.SBItems;
import mods.flammpfeil.slashblade.recipe.RequestDefinition;
import mods.flammpfeil.slashblade.recipe.SlashBladeIngredient;
import mods.flammpfeil.slashblade.recipe.SlashBladeShapedRecipeBuilder;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.world.item.Items;
import net.minecraftforge.common.crafting.conditions.IConditionBuilder;

import java.util.function.Consumer;

public class GBRecipeProvioder extends RecipeProvider implements IConditionBuilder {
    //合成表datagen
    public GBRecipeProvioder(PackOutput output) {
        super(output);
    }
    protected void buildRecipes(Consumer<FinishedRecipe> consumer){
        SlashBladeShapedRecipeBuilder.shaped(GBBuiltInRegsitry.stickgodfox.location())
                .pattern("AB ")
                .pattern("CDC")
                .pattern(" EA")
                .define('A', Items.REDSTONE)
                .define('B', Items.FLINT)
                .define('C', Items.IRON_INGOT)
                .define('D',SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(GBBuiltInRegsitry.RUSTGODFOX.location())
                                .proudSoul(500)
                                .refineCount(1)
                                .build()
                ))
                .define('E',Items.STICK)
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(GBBuiltInRegsitry.WHITEGODFOX.location())
                .pattern("ABA")
                .pattern("ACA")
                .pattern("ADA")
                .define('A', SBItems.proudsoul_ingot)
                .define('B', Items.OAK_LOG)

                .define('C',SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(GBBuiltInRegsitry.stickgodfox.location())
                                .killCount(500)
                                .proudSoul(2500)
                                .refineCount(5)
                                .build()
                ))
                .define('D', Items.OAK_SLAB)
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);

        SlashBladeShapedRecipeBuilder.shaped(GBBuiltInRegsitry.GODFOX.location())
                .pattern("ABA")
                .pattern("CDE")
                .pattern("ABA")
                .define('A', SBItems.proudsoul_ingot)
                .define('B', GBItemRegsitry.tearfluorite.get())
                .define('C', SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(SlashBladeBuiltInRegistry.FOX_WHITE.location())
                                .killCount(500)
                                .proudSoul(10000)
                                .refineCount(10)
                                .build()
                ))
                .define('D',SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(GBBuiltInRegsitry.WHITEGODFOX.location())
                                .killCount(500)
                                .proudSoul(10000)
                                .refineCount(10)
                                .build()
                ))
                .define('E', SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(SlashBladeBuiltInRegistry.FOX_BLACK.location())
                                .killCount(500)
                                .proudSoul(10000)
                                .refineCount(10)
                                .build()
                ))
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(GBBuiltInRegsitry.TRUEGODFOX.location())
                .pattern("ABA")
                .pattern("CDC")
                .pattern("ABA")
                .define('A', SBItems.proudsoul_ingot)
                .define('C', GBItemRegsitry.tearfluorite.get())
                .define('B', Items.NETHER_STAR)
                .define('D', SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(GBBuiltInRegsitry.GODFOX.location())
                                .killCount(1200)
                                .proudSoul(25000)
                                .refineCount(10)
                                .build()
                ))

                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(GBBuiltInRegsitry.NEOGODFOX.location())
                .pattern("ABA")
                .pattern("CDC")
                .pattern("EBE")
                .define('A', Items.DIAMOND_BLOCK)
                .define('B', Items.NETHER_STAR)
                .define('C', GBItemRegsitry.tearfluorite.get())
                .define('D',SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(GBBuiltInRegsitry.GODFOX.location())
                                .killCount(1500)
                                .proudSoul(15000)
                                .refineCount(30)
                                .build()
                ))
                .define('E',Items.GLOWSTONE)
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(GBBuiltInRegsitry.truebloodfox.location())
                .pattern("ABA")
                .pattern("CDC")
                .pattern("AEA")
                .define('A', GBItemRegsitry.the_blood_tear.get())
                .define('C', GBItemRegsitry.tearfluorite.get())
                .define('B', Items.NETHER_STAR)
                .define('E', SBItems.proudsoul_trapezohedron)
                .define('D',SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(GBBuiltInRegsitry.GODFOX.location())
                                .killCount(1500)
                                .proudSoul(30000)
                                .refineCount(20)
                                .build()
                ))

                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
    }
}
